#pragma once
#include "Utils.h"
#include "State.h"
#include "DirectInput.h"

class App
{
protected:
	LPTSTR			m_sName;
	HINSTANCE				m_hInstance;
	HWND					m_hWnd;

	IDirect3D9*				m_pD3dObject;
	D3DPRESENT_PARAMETERS	m_d3dPP;
	D3DDEVTYPE				m_devType;
	DWORD					m_requestedVP;

	State* m_pCurrentState;
public:
					App(HINSTANCE p_hInstance, LPTSTR p_sName, D3DDEVTYPE p_devType, DWORD p_requestedVP);
	virtual			~App();

	virtual void	initWindow();
	virtual void	initDirectX();
	virtual void	initState();
	virtual LRESULT msgProc(UINT p_uMsg, WPARAM p_wParam, LPARAM p_lParam);

	LPTSTR			getName();
	HINSTANCE		getInstance();
	HWND			getWnd();

	virtual bool	checkDevCaps();
	bool			isDevReady();
	virtual void	switchScreenMode(bool p_bFullScreen = true);
	virtual int		run();

	void setCurrentState(State * p_pState);
	State* getCurrentState();
};

extern App*					g_pApp;
extern IDirect3DDevice9*	g_pD3dDev;

